<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>订单详情</title>
    <link rel="stylesheet" href="/app/admin/component/layui/css/layui.css">
    <style>
        .detail-box {
            padding: 20px;
        }
        .detail-title {
            font-size: 16px;
            font-weight: bold;
            margin-bottom: 15px;
            padding-bottom: 10px;
            border-bottom: 1px solid #eee;
        }
        .detail-item {
            margin-bottom: 10px;
            line-height: 24px;
        }
        .detail-label {
            color: #666;
            display: inline-block;
            width: 100px;
        }
        .goods-table {
            margin-top: 20px;
        }
    </style>
</head>
<body>
    <div class="detail-box">
        <!-- 订单基本信息 -->
        <div class="detail-title">订单信息</div>
        <div class="detail-item">
            <span class="detail-label">订单号：</span>
            <span><?php echo $order->order_no; ?></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">订单状态：</span>
            <span>
                <?php
                    $statusMap = [
                        0 => '待支付',
                        1 => '已支付',
                        2 => '已退款',
                        5 => '已取消'
                    ];
                    echo $statusMap[$order->status] ?? '未知状态';
                ?>
            </span>
        </div>
        <div class="detail-item">
            <span class="detail-label">支付方式：</span>
            <span>
                <?php
                    $payTypes = [
                        1 => '在线支付',
                        2 => '现金支付',
                        3 => '余额支付'
                    ];
                    echo $payTypes[$order->pay_type] ?? '未知';
                ?>
            </span>
        </div>
        <div class="detail-item">
            <span class="detail-label">订单金额：</span>
            <span>￥<?php echo $order->total_amount; ?></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">优惠金额：</span>
            <span>￥<?php echo $order->discount_amount; ?></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">实付金额：</span>
            <span>￥<?php echo $order->paid_amount; ?></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">下单时间：</span>
            <span><?php echo $order->created_at; ?></span>
        </div>
        
        <!-- 会员信息 -->
        <?php if($order->user_id): ?>
        <div class="detail-title">会员信息</div>
        <div class="detail-item">
            <span class="detail-label">会员姓名：</span>
            <span><?php echo $order->member_name; ?></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">手机号：</span>
            <span><?php echo $order->member_phone; ?></span>
        </div>
        <?php endif; ?>
        
        <!-- 门店信息 -->
        <div class="detail-title">门店信息</div>
        <div class="detail-item">
            <span class="detail-label">门店名称：</span>
            <span><?php echo $order->store_name; ?></span>
        </div>
        <div class="detail-item">
            <span class="detail-label">操作员：</span>
            <span><?php echo $order->staff_name; ?></span>
        </div>
        
        <!-- 商品信息 -->
        <div class="detail-title">商品信息</div>
        <table class="layui-table goods-table">
            <thead>
                <tr>
                    <th>商品名称</th>
                    <th>单价</th>
                    <th>数量</th>
                    <th>小计</th>
                </tr>
            </thead>
            <tbody>
                <?php foreach($order->goods as $goods): ?>
                <tr>
                    <td><?php echo $goods->goods_name; ?></td>
                    <td>￥<?php echo $goods->goods_price; ?></td>
                    <td><?php echo $goods->quantity; ?></td>
                    <td>￥<?php echo $goods->final_amount; ?></td>
                </tr>
                <?php endforeach; ?>
            </tbody>
        </table>
        
        <!-- 备注信息 -->
        <?php if($order->remark): ?>
        <div class="detail-title">备注信息</div>
        <div class="detail-item"><?php echo $order->remark; ?></div>
        <?php endif; ?>
    </div>
</body>
</html> 